package com.qf.controller;

import com.qf.pojo.Exam;
import com.qf.service.ExamService;
import com.qf.utils.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/exam")
public class ExamController {
    @Autowired
    ExamService examService;

    @GetMapping("list")
    public ResultMsg list(Integer classId, Integer courseId, int page, int limit) {
        return examService.list(classId, courseId, page, limit);
    }

    @RequestMapping("deletelist")
    public ResultMsg deletelist(List<Integer> examIds) {
        return examService.deleteByid(examIds);
    }

    @GetMapping("/selectByid")
    public ResultMsg selectByid(Integer examId) {
        return examService.selectByid(examId);
    }

    @RequestMapping("/deleteByid")
    public ResultMsg deleteByid(Integer examId) {
        return examService.deleteByid(examId);
    }

    @GetMapping("/add")
    public ResultMsg add(@RequestBody Exam exam) {
        return examService.insert(exam);
    }
    @GetMapping("/update")
    public ResultMsg update(@RequestBody Exam exam){
       return examService.updateByid(exam);
    }
    @RequestMapping("/updatestatusByid")
    public ResultMsg updatestatus(int id){
       return examService.updatestatus(id);
    }
}
